<?php

/**
 * 加载配置文件
 */
function include_config_file($file_name){
    if(file_exists("application/Auto/Conf/".$file_name.".php")){
        require_once "application/Auto/Conf/".$file_name.".php";
    }else{
        die($file_name."文件不存在！");
    }

}

/**
 * 写入文件
 */
function write_file($file_path,$content){
    $fp=fopen($file_path,"w");
    fwrite($fp,$content);
    fclose($fp);
    return true;
}

/**
 * 获取模板组建
 */
function get_tpl($tpl_name,$data){
    $content = file_get_contents('application/Auto/Tpl/'.$tpl_name.".html");
    foreach($data AS $key => $value){
        $content = str_replace('_'.$key."_",$value,$content);
    }
    return $content;
}

/**
 * 获取Php模板
 */
function get_tpl_php($tpl_name,$data){
    $content = file_get_contents('application/Auto/Tpl/'.$tpl_name.".php");
    foreach($data AS $key => $value){
        $content = str_replace('_'.$key."_",$value,$content);
    }
    return $content;
}

